package com.longxiao.validator;

/**
 * Created by houhongwei on 2017/5/12.
 */
public class ValidResult {

    boolean isValid;

    String msg;

    public ValidResult(boolean isValid) {
        this.isValid = isValid;
    }

    public ValidResult(boolean isValid, String msg) {
        this.isValid = isValid;
        this.msg = msg;
    }

    public static ValidResult createSucc() {
        return new ValidResult(Boolean.TRUE);
    }

    public static ValidResult createFail(String msg) {
        return new ValidResult(Boolean.FALSE, msg);
    }

    @Override
    public String toString() {
        return "ValidResult{" +
                "isValid=" + isValid +
                ", msg='" + msg + '\'' +
                '}';
    }

    public boolean isValid() {
        return isValid;
    }

    public void setValid(boolean valid) {
        isValid = valid;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
